package com.activepad.module.customer.action;

import java.util.List;

import com.activepad.common.action.SurveyAction;
import com.activepad.module.customer.pojo.CustomerVo;
import com.activepad.module.customer.service.EnterpriseCustomerService;
import com.common.util.ObjectUtils;

/**
 * 
 * 企业客户Action请求处理类
 * 
 * @author 孙树林
 * 
 */
public class EnterpriseCustomerAction extends SurveyAction {

	private static final long serialVersionUID = 7997781701182269677L;

	private CustomerVo customerVo = new CustomerVo();

	private EnterpriseCustomerService enterpriseCustomerService;

	/**
	 * 查询企业客户请求处理方法
	 * 
	 * @author 孙树林
	 * @return
	 */
	public String searchEnterpriseCustomer() {
		List<CustomerVo> customerVos = enterpriseCustomerService.searchEnterpriseCustomer(customerVo);
		customerVo.setCustomerVos(customerVos);
		return SUCCESS;
	}

	/**
	 * 查找某一个企业客户资料请求处理方法
	 * 
	 * @author 孙树林
	 * @return
	 */
	public String findEnterpriseCustomer() {
		Integer id = customerVo.getId();
		if(!ObjectUtils.isNull(id)) {
			customerVo = enterpriseCustomerService.findEnterpriseCustomer(id);
		}
		return SUCCESS;
	}
	
	/**
	 * 编辑企业客户资料信息
	 * 
	 * @author 孙树林
	 * @return
	 */
	public String editEnterpriseCustomer() {
		enterpriseCustomerService.editEnterpriseCustomer(customerVo);
		return SUCCESS;
	}
	
	/**
	 * 删除企业客户资料信息
	 * @return
	 */
	public String deleteEnterpriseCustomer() {
		enterpriseCustomerService.deleteEnterpriseCustomer(customerVo);
		return SUCCESS;
	}

	public void setEnterpriseCustomerService(EnterpriseCustomerService enterpriseCustomerService) {
		this.enterpriseCustomerService = enterpriseCustomerService;
	}

	public CustomerVo getCustomerVo() {
		return customerVo;
	}

	public void setCustomerVo(CustomerVo customerVo) {
		this.customerVo = customerVo;
	}
}